package ua.kpi.ustymenko;
import ua.kpi.ustymenko.io.ClientIO;

public class LoginHelper {
    private static LoginHelper instance = null;
    private ClientIO clientIO;
    private boolean logged;
    private User loggedUser;

    private LoginHelper() {
        clientIO = new ClientIO();
        logged = false;
    }

    public static LoginHelper getInst() {
        if (instance == null) {
            instance = new LoginHelper();
        }
        return instance;
    }

    public void login() {
        loggedUser = new User(clientIO.getUserName());
        logged = true;
    }

    public void logout() {
        loggedUser = null;
        logged = false;
    }

    public boolean isLogged() {
        return logged;
    }

    public User getLoggedUser() {
        return loggedUser;
    }
}

